﻿@model EM.OA.Portal.Models.DepartmentModels
@{
    Layout = "~/Views/Shared/_LayoutContent.cshtml";
}
<script type="text/javascript" src="~/Scripts/page/SystemSetting/Department.js"></script>

<div class="easyui-layout" fit="true">
    <div region="west" split="true" title="组织机构" style="width: 150px;">
        @*tree0*@
        @Html.Partial("~/Views/Shared/_DepartmentTreeViewPartial.cshtml")
        @*tree2*@
        <ul class="easyui-tree" id="department_tree2"></ul>
    </div>
    <div data-options="region:'center',title:'组织机构列表'" style="background: #fafafa; overflow: hidden;">
        @*list*@
        <table id="list" class="easyui-datagrid" toolbar="#toolbar">
        </table>
        <div id="toolbar">
            <a href="#" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="add()">增加</a>
            <a href="#" class="easyui-linkbutton" iconcls="icon-edit" plain="true" onclick="edit()">修改</a>
            <a href="#" class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="del()">删除</a>
        </div>
    </div>

</div>

@*Detail*@
<div id="dlg" class="easyui-dialog" style="width: 550px; height: 420px; padding: 10px 20px"
    closed="true" buttons="#dlg-buttons" modal="true" resizable="true">
    <form id="fm" method="post">
        @Html.HiddenFor(m => m.DepartmentID)
        <table>
            <tr>
                <td>@Html.LabelFor(m => m.DepartmentName)</td>
                <td>@Html.TextBoxFor(m => m.DepartmentName, new { @class = "easyui-validatebox", @required = "true" })</td>
            </tr>
            <tr>
                <td>@Html.LabelFor(m => m.DepartmentParentID)</td>
                <td>
                    <input id="comb_DepartmentParentID" class="easyui-combotree"
                        data-options="url:'/Department/GetTreeList',required:true,
                        onSelect: function(rec){  
                            $('#DepartmentParentID').val(rec.id); }" />
                    <input id="DepartmentParentID" name="DepartmentParentID" type="hidden" />
                </td>
            </tr>
            <tr>
                <td>@Html.LabelFor(m => m.ManageUserID)</td>
                <td>
                    <input type="hidden" id="ManageUserID" name="ManageUserID" />
                    <input class="easyui-validatebox" type="text" id="ManageUserName" name="ManageUserName" />
                    <a href="#" class="easyui-linkbutton" onclick="GetUserList()" plain="true">选择</a>
                </td>
            </tr>

            <tr>
                <td>@Html.LabelFor(m => m.Telephone)</td>
                <td>@Html.TextBoxFor(m => m.Telephone, new { @class = "easyui-validatebox" })
                </td>
            </tr>
            <tr>
                <td>@Html.LabelFor(m => m.Address)</td>
                <td>@Html.TextBoxFor(m => m.Address, new { @class = "easyui-validatebox" })</td>
            </tr>
            <tr>
                <td>@Html.LabelFor(m => m.Sort)</td>
                <td>
                    <input class="easyui-numberbox" id="Sort" name="Sort" data-options="precision:0,groupSeparator:' ',decimalSeparator:','" />
                </td>
            </tr>
            <tr>
                <td>@Html.LabelFor(m => m.Description)</td>
                <td>
                    @Html.TextAreaFor(m => m.Description, new { @style = "width:100%", @rows = "10", @class = "easyui-validatebox" })
                </td>
            </tr>
        </table>

    </form>
</div>
<div id="dlg-buttons">
    <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="save()">保存</a>
    <a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">取消</a>
</div>

<div id="userdlg" class="easyui-dialog" style="width: 480px; height: 380px; padding: 10px 10px"
    closed="true" buttons="#userdlg-buttons" modal="true" resizable="true">

    <table id="userlist" class="easyui-datagrid" width="100%" toolbar="#usertoolbar">
    </table>
    <div id="usertoolbar">
        <table>
            <tr>
                <td>
                    <input class="easyui-validatebox" type="text" id="userName" name="userName"
                        value="用户名称" onfocus="if(value==defaultValue){value='';this.style.color='#000'}" onblur="if(!value){value=defaultValue;this.style.color='#999'}"style="color:#999999" />
                </td>
                <td>
                    <input value="请选择部门" 
                        id="comb_Search_DepartmentParentID" class="easyui-combotree"
                        data-options="url:'/Department/GetTreeList',required:true,
                        onSelect: function(rec){  
                            $('#DepartmentParentID').val(rec.id); }" />
                </td>
                <td>
                    <a href="#" class="easyui-linkbutton" iconcls="icon-search" onclick="Search()">查询</a>
                </td>
            </tr>
        </table>


    </div>

    <div id="userdlg-buttons">
        <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="SelectUser()">确定</a>
        <a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#userdlg').dialog('close')">取消</a>
    </div>
</div>

